﻿@model KL.Store.Web.Models.BrandModel
<div class="box category">
    <div class="box-heading">
        Markalar
    </div>
    <div class="box-content">
        @if (ViewBag.ShowAll)
        {
            <div class="box-content">
                <div class="checkbox">
                    <label>
                        <input type="checkbox" id="tumu">
                        Tüm Ürünler Gelsin (Pasif ve Varyantlar)
                    </label>
                </div>
            </div>
        }
        @Html.DropDownListFor(m => m.SelectedBrand, new SelectList(Model.Brands, "GroupId", "GroupName"), new { @class = "form-control brandSelect", @style = "width:100%", id = @ViewBag.Id })
    </div>
</div>
<script type="text/javascript">
    $('#@(ViewBag.Id)').change(function ()
    {
        var url = $(this).val();
        if (url > 0)
        {
        @if (ViewBag.ShowAll)
        {
            <text>
            if ($(this).parent().parent().find('#tumu').is(':checked'))
            {
                window.location = "/urunlerfull/Marka-" + url + ".html";
            }
            else
            {
                window.location = "/Marka-" + url + ".html";
            }
        </text>
        }
        else
        {
            <text>window.location = "/Marka-" + url + ".html";</text>            
        }
        }
    });


    function submitBrand()
    {
        var url = $('.brandSelect').val();
        alert(url);
        if (url > 0)
        {
        @if (ViewBag.ShowAll)
        {
            <text>
            if ($('#tumu').is(':checked'))
            {
                window.location = "/urunlerfull/Marka-" + url + ".html";
            }
            else
            {
                window.location = "/Marka-" + url + ".html";
            }
        </text>
        }
        else
        {
            <text>window.location = "/Marka-" + url + ".html";</text>            
        }
        }
    }
</script>
